package com.jz.planclass.mapper;

import com.jz.planclass.model.PlanClassSelectVo;
import com.jz.planclass.model.PlanClassVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * Created by WISE on 2021/12/27.
 */
@Mapper
public interface PlanClassMapper {
    List<PlanClassVo> queryData(PlanClassSelectVo planClassSelectVo);

    int quertCount(PlanClassSelectVo planClassSelectVo);

    @Select("select * from planclass where code = #{code}")
    PlanClassVo queryByCode(@NotBlank(message = "编码不能为空") String code);

    @Select("select * from planclass where name = #{name}")
    PlanClassVo queryByName(@NotBlank(message = "名称不能为空") String name);

    @Insert("insert into planclass(name,code,remark,status,creatTime,creatName) " +
            "values(#{name},#{code},#{remark},#{status},#{creatTime},#{creatName})")
    void add(PlanClassVo classVo);

    @Select("select * from planclass where id = #{id}")
    PlanClassVo queryById(Integer id);

    @Update("update subclass set status = #{status},updaetTime = #{updateTime},updateName = #{updateName} where id = #{id}")
    void updateStatus(PlanClassVo planClassVo1);
}
